<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<jsp:include page="../frame/header.jsp"></jsp:include>

<title>添加常用信息</title>
</head>

<body>
	<div class="container-fluid">
		<div class="row-fluid">
			<div>
				<ul class="breadcrumb">
					<li><a href="#">生活信息</a> <span class="divider">/</span></li>
					<li><a href="#">常用信息指南</a></li>
				</ul>
			</div>

			<div class="box">
				<div class="box-header well" data-original-title>
					<h2>
						<i class="icon-edit"></i> 添加常用信息
					</h2>
					<div class="box-icon">
						<a href="#" class="btn btn-setting btn-round"><i
							class="icon-cog"></i></a> <a href="#"
							class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						<a href="#" class="btn btn-close btn-round"><i
							class="icon-remove"></i></a>
					</div>
				</div>
				<div class="box-content">
					<form id="myform" class="form-horizontal" method="post" action="<c:url value="/admin/live/common" />">
						<fieldset>
							<input type="hidden" name="infoId" value="${common.infoId }">
							<div class="control-group">
								<label class="control-label" for="username">分类</label>
								<div class="controls">
									<select id="sortId" name="sortId" class="input-xlarge" name="liveSorts" >
									<c:forEach var="sort" items="${sorts }">
										<option value="${sort.sortId }" <c:if test='${sort.sortId == common.sortId }'>selected</c:if> >${sort.sortName }</option>
									</c:forEach>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="name">名称</label>
								<div class="controls">
									<input class="input-xlarge" id="name" name="name" type="text"
										value="${common.name }" placeholder="" maxlength="50" check-type="required" required-message="请输入名称">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="phone">电话</label>
								<div class="controls">
									<input class="input-xlarge" id="phone" name="phone" type="text"
										value="${common.phone }" maxlength="30" check-type="required" required-message="请输入电话号码">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="description_mc">详细描述 </label>
								<div class="controls">
									<textarea name="description_mc" rows="6" class="input-xxlarge">${common.description_mc }</textarea>
								</div>
							</div>
							<div class="form-actions">
								<button id="saveBtn" type="button" class="btn btn-primary">保存</button>
								<button id="cancelBtn" type="button" class="btn">返回</button>
							</div>
						</fieldset>
					</form>

				</div>
			</div>
			<!--/span-->

		</div>
	</div>
	<!--/row-->
</body>

<jsp:include page="../frame/scripts.jsp"></jsp:include>
<script type="text/javascript">
$(document).ready(function(){
	$('#cancelBtn').click(function(){
		window.location.href = '<c:url value="/admin/live/live_common" />';	
	})
	
	$("#myform").validation();
	
	//保存
	$('#saveBtn').click(function(){
		if($("#sortId").val() == null){
			alert("请首先创建属于常用信息的分类！");
			return;
		}
		$("#myform").submit();
	})
})
</script>